import {
  apiUrl
} from '../../config/index'
Page({
  data: {
    banners: [{
      imageUrl: apiUrl + '/gallery/0_banner.jpg'
    }],
    tools: [{
      code: 'cmd',
      title: '控制台'
    }, ],
    features: [{
      name: '在线编辑VUE'
    }, ],
  },
  clickTool(e) {
    let token = wx.getStorageSync('token')
    let code = e.currentTarget.dataset.code
    if (code == 'cmd') {
      //进入控制台
      if (!token) {
        wx.showToast({
          title: '请先登录',
          icon: 'none',
          duration: 2000,
        });
        // 这里可以添加跳转到登录页面的逻辑
        wx.navigateTo({
          url: '/pages/login/index',
        })
        return
      }
      wx.navigateTo({
        url: '/pages/cmd/index',
      })

    }
  }
});